﻿@model CMS.BL.Entity.tbl_Content

<div class="sectionHeader" data-bind="text: sectionHeader"></div>
<div class="sectionWindow">
    <div class="btnToggleSection">Page Details +</div>
    <form id="DetailsForm" action="#" class="sectionContent">
        <div>
            @Html.LabelFor(m => m.tbl_SiteMap.SM_DomainID, "Domain")
            @Html.DropDownListFor(m => m.tbl_SiteMap.SM_DomainID, this.ViewBag.Domains as SelectList, new { @class = "short", id = "ddlDomain" })
            @Html.HiddenFor(m => m.ContentID)
            @Html.HiddenFor(m => m.tbl_SiteMap.SiteMapID, new { id = "SiteMapID" })
        </div>
        <hr />
        <h2>Date of the blog entry</h2>
        <div>
            <div class="inputContainer">
            <label for="BlogDate">Date/Time</label>
            <input id="BlogDate" name="blogDate" type="text" data-input-type="dateTime" value="@((Model != null ? Model.tbl_SiteMap.SM_Date.GetValueOrDefault(DateTime.Now) : DateTime.Now).ToString("dd/MM/yyyy HH:mm", System.Globalization.CultureInfo.CreateSpecificCulture("en-US")))" />
            </div>
            <span>dd/mm/yyyy hh:mm</span>
            <span class="description">Date the blog post, this will date will be shown on the front end.</span>
        </div>
    </form>
</div>
@Html.Action("SEONewsFields", "Admn", new { contentID = Model != null ? Model.ContentID : 0 })
<div class="sectionWindow">
    <div class="btnToggleSection">Page Content +</div>
    <div class="sectionContent">
        <div>
            <textarea id="BlogContent" name="BlogContent" class="tinyMCEEditor" data-count="true" data-minWords="250">@(Model != null ? Model.C_Content : ViewBag.DefaultWyswigContent)</textarea>
            <span data-for="BlogContent" class="counter"><span data-name="icon" title="Your Page Contents must be at least 250 words long, ideally approaching 400 words!"></span><span data-name="text"></span></span>
        </div>
    </div>
</div>
<div id="Options" class="sectionWindow">
    <div class="btnToggleSection">Options +</div>
    <div class="sectionContent">
        <h2>Update your Twitter</h2>
        <div>
            @Html.LabelFor(m => m.SUB_Tweet)
            @Html.TextBoxFor(m => m.SUB_Tweet, new { id = "tbTweet", @class = "long", data_count = "true", data_minChars = "1", data_maxChars = "116", maxlength = "116" })
            <span data-for="SUB_Tweet" class="counter"><span data-name="icon" title="The Tweet field can contain up to 116 characters, the URL will be appended to the end!"></span><span data-name="text"></span></span>
            <span class="description">Use this filed to send it to your Twitter.</span>
        </div>
        <hr />
        <h2>Add tags/categories to your blog entry</h2>
        <div data-bind="visible: isEdit">
            <label for="tbTag">Tags</label>
            @if ((User as CMS.Utils.CustomPrincipal).HasPermission(CMS.BL.Permission.EditNews))
            {
            <input id="tbTag" name="tag" type="text" />
            <input type="button" class="btnGreyGreen" value="Add" title="Add Tags" data-bind="click: onAddTag" />
            <span class="description">Add a tag so you can link different blog post together.</span>
            }
        </div>
        <div data-bind="visible: isEdit">
            <div class="checkBoxList" data-bind="foreach: tags">
                <span>
                    <span class="deleteLink" data-bind="click: $parent.onDeleteTag, attr: { 'data-tagID': Value }, text: Text"></span>
                </span>
            </div>
        </div>
        <hr data-bind="visible: isEdit" />
        <div>
            <label for="tbCategory">Categories</label>
            @if ((User as CMS.Utils.CustomPrincipal).HasPermission(CMS.BL.Permission.EditNews))
            {
            <input id="tbCategory" name="category" type="text" />
            <input type="button" class="btnGreyGreen" value="Add" title="Add Categories" data-bind="click: onAddCategory" />
            }
        </div>
        <div>
            <div class="checkBoxList" data-bind="foreach: categories">
                <span>
                    <input type="checkbox" name="category" data-bind="click: $parent.onSaveNewsCategory, value: Value, checked: Selected, attr: { id: 'cat' + Value }" />
                    <label data-bind="text: Text, attr: { 'for': 'cat' + Value }"></label>
                    <span class="deleteLink" data-bind="click: $parent.onDeleteCategory, attr: { 'data-categoryID': Value, title: 'Delete ' + Text }"></span>
                </span>
            </div>
        </div>
    </div>
</div>
@Html.Action("BlogContentVersion", "Admn", new { sectionID = Model != null ? Model.tbl_SiteMap.SiteMapID : 0, contentID = Model != null ? Model.ContentID : 0 })
<div>
    @if ((User as CMS.Utils.CustomPrincipal).HasPermission(CMS.BL.Permission.AddNews))
    {
    <input type="button" id="btnNewPage" name="NewPage" class="btnGreen" value="Add news" data-bind="click: onSubmit, visible: !isEdit()"/>
    }
    @if ((User as CMS.Utils.CustomPrincipal).HasPermission(CMS.BL.Permission.EditNews))
    {
    <input type="button" id="btnSavePage" name="SavePage" class="btnGreen" value="Update news" data-bind="click: onSubmit, visible: isEdit"/>
    }
    @if ((User as CMS.Utils.CustomPrincipal).HasPermission(CMS.BL.Permission.ApproveContent))
    {
    <input type="button" id="btnApprovePage" name="ApprovePage" class="btnGrey" value="Approve Content" data-bind="click: onApprove, visible: isEdit"/>
    }
    <input type="button" id="btnCancel" name="Cancel" class="btnRed" value="Cancel" data-bind="click: onNewArticle" />
</div>